<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/static/favicon.ico" >
<link rel="Shortcut Icon" href="/static/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/static/hui/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/hui/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/hui/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/static/hui/h-ui.admin/css/style.css" />
<link rel="stylesheet" type="text/css" href="/static/uploadify/uploadify.css" />
<script type="text/javascript" src="/static/plupload/js/plupload.full.min.js"></script>

<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<title>新增文章 - 资讯管理 - H-ui.admin v3.1</title>
<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
  <form class="form form-horizontal" id="form-article-add">
    <div class="row cl">
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>缩略图：</label>
      <div class="formControls col-xs-8 col-sm-9">
        <div class="uploader-thum-container">
        <div id="filelist"></div>
         <div id="container">
         <a id="pickfiles" href="javascript:;">[选择文件]</a> 
         <a id="uploadfiles" href="javascript:;">[上传文件]</a>
         </div>
    <div class="preview">
      <ul id="previewImgs"></ul>
    </div>
       <input name="pic_url" style="display:none;" id="saveurl" value="{$list['pic_url']}" />
        </div>
      </div>
    </div>
    <input type="text" style="display: none;" name="id" value="{$id}">
    <input type="text" style="display: none;" name="oldpic" value="{$list['pic_url']}">
       <div class="row cl">
      <label class="form-label col-xs-4 col-sm-2">排序值：</label>
      <div class="formControls col-xs-8 col-sm-9">
        <input type="text" class="input-text"  placeholder="" id="sort" name="sort" value="{$list['sort']}">
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>跳转课程ID：</label>
      <div class="formControls col-xs-8 col-sm-9">
        <input type="text" class="input-text" placeholder="" id="jump_url" name="jump_url" value="{$list['jump_url']}">
      </div>
    </div>
    <div class="row cl">
      <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
        <a id="sava_submit" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe632;</i>保存提交</a>
        <a onClick="article_save();" class="btn btn-secondary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 取消提交</a>
      </div>
    </div>
  </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/hui/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/static/hui/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer /作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/static/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script src="/static/uploadify/baidu-jquery-1.9.0.js" type="text/javascript"></script>
<script src="/static/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/static/js/dialog/layer.js"></script>
<script type="text/javascript" src="/static/js/dialog.js"></script>
<script type="text/javascript">
  var uploader = new plupload.Uploader({
  runtimes : 'html5,flash,silverlight,html4',
  browse_button : 'pickfiles', // you can pass an id...
  container: document.getElementById('container'), // ... or DOM Element itself
  url : '/admin/imgupload/imgupload',
  flash_swf_url : '/static/plupload/js/Moxie.swf',
  silverlight_xap_url : '/static/plupload/js/Moxie.xap',
  
  filters : {
    max_file_size : '10mb',
    mime_types: [
      {title : "Image files", extensions : "jpg,gif,png"},
      {title : "Zip files", extensions : "zip"}
    ]
  },

  init: {
    PostInit: function() {
      document.getElementById('filelist').innerHTML = '';

      //点击触发开发上传按钮
      document.getElementById('uploadfiles').onclick = function() {
        uploader.start();
        return false;
      };
    },
    //文件被选中的时候
    FilesAdded: function(up, files) {
      plupload.each(files, function(file) {
        document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
      });
    },
        //文件上过过程中显示进度
    UploadProgress: function(up, file) {
      document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
    },

    Error: function(up, err) {
      document.getElementById('console').appendChild(document.createTextNode("\nError #" + err.code + ": " + err.message));
    },
    FileUploaded: function(up, file, data) { //文件上传成功的时候触发 
        var obj = jQuery.parseJSON(data.response);
          $("#themp").attr('value',obj.savepath);
          var imgstr = '<li><img src="'+obj.savepath+'" alt="预览图片" width="80" height="70"><a onclick=goDel(this,"'+obj.savepath+'")>删除</a></li>';
          $("#previewImgs").append(imgstr);
          $("#saveurl").append(obj.savename);
    }
  }
});

uploader.init();    
       //点击上传按钮上传数据
$("#sava_submit").on('click',function(){
 var data=$('#form-article-add').serializeArray();
      var url="/admin/room/piclun_update";
      $.post(url,data,function(result)
      {

           if(result.code==1)
           {
             dialog.ok(result.msg);
           }
           else
           {
             dialog.ok(result.msg);
           }
      },'JSON');
     });


  // ajax 删除预览列表中的一张图片
  function goDel(objdom,src){
    //先执行ajax删除图片，删除成功之后 删除预览图片
    //alert(src);
    $(objdom).parent().remove();
    //删除预览图片之后还要 修改 id="saveurl" 隐藏域的值，这个是写入到数据库的图片路径（我这里只是写一个测试就没有完善见谅了）

    return false;
  }
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>